Conversation
The StandardErrorListener used AnsiConsole.out directly to print progress messages, bypassing Nextflow's logger which respects the `-q` flag. Add a `quiet` parameter to StandardErrorListener that suppresses progress output (beforeAll, beforeFile, beforeFormat, afterAll) while still showing errors and warnings. Signed-off-by: nextflow-io <info@nextflow.io> https://claude.ai/code/session_01MY4FcPPaSmACrBsdpHTfnT Signed-off-by: Claude <noreply@anthropic.com>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
74b4029 to
183ae1e
Compare
Two issues were causing test failures: 1. StandardErrorListener was printing via AnsiConsole.out, which is a static field initialized at class-load time and not updated when OutputCapture replaces System.out. Switch all output to System.out so test capture works correctly. 2. CmdLint is @CompileStatic, so the Groovy compiler generates a call to isQuiet() (boolean convention) rather than getQuiet() when accessing launcher.options.quiet. The test stubs were using getQuiet() >> true, which was never called, so quiet was always false. Fix by stubbing isQuiet() >> true instead. Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
This comment was marked as outdated.
This comment was marked as outdated.
Introduce a private print() helper that consolidates all output via a single code path: - When ansiLog=true, delegates to AnsiConsole.out, which handles TTY detection and strips ANSI escape codes when writing to a pipe. - When ansiLog=false, sets Ansi.setEnabled(false) immediately before rendering the Ansi object to plain text, then writes to System.out. Setting the flag just before toString() ensures the global Ansi state is correct at render time regardless of what other components may have set in between. Writing to System.out (rather than the static AnsiConsole.out field) means the output is captured correctly by test infrastructure that replaces System.out. Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
This comment was marked as outdated.
This comment was marked as outdated.
Ansi.setEnabled() is static-only in Jansi 2.x -- there is no per-instance flag. Ansi.toString() returns the raw StringBuilder contents; escape codes are baked in when fg()/bold() etc. are called, not at render time. The previous approach of calling Ansi.setEnabled(false) in print() just before toString() was too late: codes were already in the buffer. Fix: call Ansi.setEnabled(ansiLog) inside the ansi() helper, before every Ansi object is created. This ensures the global flag is correct for all subsequent append operations, so plain-text output is produced when ansiLog=false (e.g. when writing to a pipe in integration tests). Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
Further fix: ANSI code strippingAfter more investigation, the previous approach of calling Root cause: So calling Fix: move |
- StandardErrorListener now suppresses progress messages (file-by-file status and final summary) when ansiLog=false, i.e. when running with -no-ansi or NXF_ANSI_LOG=false. The animated progress lines rely on cursor-up/erase-line ANSI sequences and are meaningless in non-interactive/piped output. - Add a -q/-quiet flag to 'nextflow lint' that suppresses progress messages at the lint-command level. Unlike the global --quiet flag this does not disable ANSI colours, so error output still benefits from colour highlighting when the terminal supports it. - Rename the internal 'quiet' flag to 'suppressProgress' to better reflect its purpose (errors are always shown; only status messages are suppressed). Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
The final 'Nextflow linting complete!' summary is now always printed, even when progress is suppressed (--quiet / -q / non-interactive output). Only the per-file 'Linting: ...' status lines are suppressed. Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
|
Ok I updated it so that there is now some slightly differing behaviour, but hopefully gives the functionality we want:
We could simplify this further by simply removing the "Linting " updates entirely as they give fairly limited functionality (just saying that something is happening). Happy to do that if you prefer @bentsherman |
nextflow lint ignores the --quiet (-q) flag. The StandardErrorListener class writes progress messages directly to AnsiConsole.out, bypassing Nextflow’s logger infrastructure which respects the -q flag.
This PR fixes that. Closes #6856